<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">

<!-- Viewport Metatag -->
<!-- <meta name="viewport" content="width=device-width,initial-scale=1.0"> -->

<!-- Plugin Stylesheets first to ease overrides -->

<!-- Required Stylesheets -->
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/bootstrap/css/bootstrap.min.css" media="screen">

<script type="text/javascript" src="__PUBLIC__/js/jquery-2.1.4.min.js"></script>


<style type="text/css">


	body{

		width: 1200px;
		/*height: 300px;*/
	}

	#sel{

		width: 174px;
	
	}




</style>
</head>

<body>
	
	<center>
		<div class="all">
			<div class="container">
			<div class="row">
				<div class="col-md-10">
						<div class="panel panel-primary">
						  <div class="panel-heading">添加分类</div>
						  <div class="panel-body">
						   
						  </div>
						  	<form action="{:U('Admin/Goodstype/insert')}" method="post" id="form1" enctype="multipart/form-data">
						  		<table class="table">
							<tr>
						   		<td></td>
							   	<th>父类名称：</th>
							   	<td>
							   	   <select name="pid" class="form-control" id="sel">
                                            <option value='0'>请选择【顶级分类】</option>
                                            	<foreach name="goodsclasses" item="vo" >
                                           		 	<option value="{$vo.id}">{$vo.type_name}</option>
                                            	</foreach>
                                    </select>

							   	</td>
						   	</tr>


						   	<tr>
						   		<td></td>
							   	<th>分类添加：</th>
							   	<td><input type="text" name="type_name"></td>
						   	</tr>
						   	
							
							<tr>
								<td></td>
								<td>分类图片：</td>
								<td><input type="file" name="img"></td>
							</tr>
							
							<tr>
               				 <td></td><td>手机号码</td><td><input id="phone" type="text">
            				</tr>

							<tr>
               				 <td></td><td>验证码：</td><td><input id="code" type="text"><span class='btn' id="btn">(60)</span class='btn'></td>
            				</tr>

						   	<tr>
						   	<td></td>
						   		<td><button type="submit" class="btn btn-primary">添加</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button class="btn btn-danger" id="btn1">重置</button></td>
						   		<td></td>
						   	</tr>
						  </table>
						  	</form> 
						  </div>
				</div>
			</div>
		</div>
	</div>	
	</center>

		

</body>
</html>
<script>
$(function(){


	  $('#btn').click(function(){
                var phone = $('#phone').val();
                $.ajax({
                    url:"/index.php/Admin/Goodstype/yzm.html",
                    data:{'phone':phone},
                    type:'post',
                    success:function(data){
                        if(data.code == 1){
                        	count = 60;
                            var CountDown = setInterval(CountDown, 1000);

                            function CountDown(){
                                $("#btn").attr("disabled", true);
                                $("#btn").html('('+count+')');
                               	console.log(count)
                                if (count == -1) {
                         			
                                    $("#btn").html("(60)").removeAttr("disabled");
                                    clearInterval(CountDown);
                                }
                                count--;
                            }                    
                        }
                    }
                })
            }) 

})
</script>
